export default {
  components: {
  },
  data() {
    return {
      treeData: []
    }
  },
  created() {

  },
  watch: {
  },
  beforeMount() {
  },
  beforeDestroy() {
  },
  mounted() {
  },
  methods: {
    /**
     * @description: 获取当前日期
     * @author: hst
     * @param: day: 0今天，-1昨天
     * 3.16: 解决默认日期月份没有补零
     */
    getDay(day) {
      var today = new Date()
      var targetday = today.getTime() + 1000 * 60 * 60 * 24 * day
      today.setTime(targetday)
      var tYear = today.getFullYear()
      var tMonth = today.getMonth()
      var tDate = today.getDate()
      tMonth = this.doHandleMonth(tMonth + 1)
      tDate = this.doHandleMonth(tDate)
      return tYear + '-' + tMonth + '-' + tDate
    },
    doHandleMonth(month) {
      var m = month
      if (month.toString().length === 1) {
        m = '0' + month
      }
      return m
    },
    deleteType(v, n) {
      console.log(n)
      console.log(this.nowTreeArr)
      this.nowTreeArr.splice(n, 1)
    },
    getNowTime(type) {
      var date = new Date()
      /**
       * @description: 新增 three 参数
       * @author: hst
       * 3.16: three代表获取当前时间精确到时分秒
       */
      if (type === 'second') {
        return date.getFullYear() + '-' + (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' 00:00:00'
      } else if (type === 'three') {
        return date.getFullYear() + '-' + (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds()
      } else {
        return date.getFullYear() + '-' + (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate())
      }
    }

  }
}
